Return to doc.sitecore.com

Valid for Sitecore 5.2, 5.1.1
  CurrentResult
Prev Next

The CurrentResult is the return value of the operation requested by the DataManager.  Every time a provider in a chain returns a ‘positive’ result (that is, an object or a True value), the CurrentResult is updated with the new value.

If the return value of a method is a collection, it will be added to CurrentResult rather than replacingit.  Thus, if a chain consists of two data providers and each returns a collection containing two elements, the final result passed to the DataManager will be a collection with four elements.  If this behavior is not desired, a data provider can nullify the CurrentReult before returning its own value.

When the chain ends, the result returned to the DataManager will be the final value of CurrentResult.

An individual data provider may update CurrentResult directly if required. For instance, if a data provider wishes to force a return value of null in a given chain, it can use code like the following:

  public override ItemDefinition GetItemDefinition(ID itemID,
  CallContext context) {
    if (conditionThatIndicatesNull) {
      context.CurrentResult = null;
      context.Abort();
      return null;
    }
 
    ...


Prev Next